Conversation
…ldp collectors in the development Makefile.
| } | ||
|
|
||
| // Helper to parse uptime string "HH:MM:SS" | ||
| func parseUptime(uptime string) (float64, error) { |
There was a problem hiding this comment.
I think it is better to reuse parseHMS from collector/pim.go as it performs the same function. Can you please reuse it, but also move parseHMS to collector/collector.go?
|
|
||
| counts := make(map[string]float64) | ||
| for _, d := range data.Adjacencies { | ||
| key := strings.Join([]string{d.AddressFamily, d.NeighborID, d.Interface, d.Type}, "|") |
There was a problem hiding this comment.
Using strings.Join with "|" as separator and then strings.Split to recover part seems risky. Could we use a structured instead? e.g.
type discoveryKey struct {
AF, Neighbor, Iface, Type string
}
| return nil | ||
| } | ||
|
|
||
| func processBindings(ch chan<- prometheus.Metric, output []byte, descs map[string]*prometheus.Desc) error { |
There was a problem hiding this comment.
Can you update this function to something like processMPLSLDPBindings so there is no conflict with other collectors?
| } `json:"bindings"` | ||
| } | ||
|
|
||
| func (c *mplsLDPCollector) collectBindings(ch chan<- prometheus.Metric) error { |
There was a problem hiding this comment.
Can you update this function to something like collectMPLSLDPBindings so there is no conflict with other collectors?
| return nil | ||
| } | ||
|
|
||
| func processIGPSync(ch chan<- prometheus.Metric, output []byte, descs map[string]*prometheus.Desc) error { |
There was a problem hiding this comment.
Can you update this function to something like processMPLSLDPIGMPSync so there is no conflict with other collectors?
| Neighbors []mplsLdpNeighbor `json:"neighbors"` | ||
| } | ||
|
|
||
| func (c *mplsLDPCollector) collectNeighbor(ch chan<- prometheus.Metric) error { |
There was a problem hiding this comment.
Can you update this function to something like collectMPLSLDPNeighbor so there is no conflict with other collectors?
|
|
||
| type mplsLdpInterfaceOutput map[string]mplsLdpInterface | ||
|
|
||
| func (c *mplsLDPCollector) collectInterface(ch chan<- prometheus.Metric) error { |
There was a problem hiding this comment.
Can you update this function to something like collectMPLSLDPInterface so there is no conflict with other collectors?
| return nil | ||
| } | ||
|
|
||
| func processNeighbor(ch chan<- prometheus.Metric, output []byte, descs map[string]*prometheus.Desc) error { |
There was a problem hiding this comment.
Can you update this function to something like processMPLSLDPNeighbor so there is no conflict with other collectors?
| Adjacencies []mplsLdpDiscovery `json:"adjacencies"` | ||
| } | ||
|
|
||
| func (c *mplsLDPCollector) collectDiscovery(ch chan<- prometheus.Metric) error { |
There was a problem hiding this comment.
Can you update this function to something like collectMPLSLDPDiscovery so there is no conflict with other collectors?
| return nil | ||
| } | ||
|
|
||
| func processDiscovery(ch chan<- prometheus.Metric, output []byte, descs map[string]*prometheus.Desc) error { |
There was a problem hiding this comment.
Can you update this function to something like processMPLSLDPDiscovery so there is no conflict with other collectors?
|
Thank you so much for contributing! I've made a few inline comments |
Summary
Implementation of the
mpls_ldpcollector to provide monitoring for MPLS Label Distribution Protocol via FRR. This addition allows for tracking LDP sessions, interface states, and label bindings.Changes
New Collector:
mpls_ldpConfiguration & Flags
Two new flags have been introduced to control the collector's behavior:
--collector.mpls_ldp: Main toggle for the collector (default: disabled).--collector.mpls_ldp.binding-in-use: Enables thefrr_mpls_ldp_binding_in_usemetric (default: disabled).Metrics Implemented
frr_mpls_ldp_interface_*(State, hello interval, holdtime, adjacency count).frr_mpls_ldp_neighbor_*(State, uptime).frr_mpls_ldp_discovery_adjacency_count.frr_mpls_ldp_binding_*(Counts and usage).frr_mpls_ldp_igp_sync_state.Development & Documentation
dev/Makefileto includeshow-mpls-ldpcommands and ensured the collector is active in the development environment for testing.